package com.yuyou.fn.crm.service;

import com.github.wens.framework.service.ISuperService;
import com.github.wens.mybatisplus.plugins.Page;
import com.yuyou.fn.common.util.Principals;
import com.yuyou.fn.crm.entity.CustomerResource;
import com.yuyou.fn.crm.vo.AnalyzeStatResultOfCustomerResourceVo;
import com.yuyou.fn.crm.vo.AnalyzeStudentOfCustomerResourceVo;
import com.yuyou.fn.crm.vo.CustomerResourceImportNumVo;
import com.yuyou.fn.crm.vo.CustomerResourceQueryVo;
import com.yuyou.fn.platform.permission.DataPermission;
import com.yuyou.fn.report.vo.StudentRegDetailQueryVo;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;

import java.util.Date;
import java.util.List;

/**
 *
 * CustomerResource 表数据服务层接口
 *
 */
public interface ICustomerResourceService extends ISuperService<CustomerResource,Long> {


    List<CustomerResource> findCustomerResourceByMarketImportId(Long marketImportId);

    void updateCustomerResourceStudentId(Long customerResourceId, Long studentId);

    boolean exist(String studentName, String phoneNo, String projectName, Date date);

    Page<CustomerResource> findCustomerResourceByQuery(DataPermission dataPermission, CustomerResourceQueryVo queryVo, int pageNo, int pageSize);

    List<CustomerResource> findCustomerResourceByPhone(String phoneNo,Date lessCreateTime) ;

    void deleteByCustomerResourceIds(List<Long> customerResourceIds);

    List<CustomerResource> findCustomerResourceByCourseOrderId(long courseOrderId) ;

    Long countCustomerResourceByQuery(DataPermission dataPermission, CustomerResourceQueryVo queryVo);

    SXSSFWorkbook exportCustomerResource(DataPermission dataPermission, CustomerResourceQueryVo queryVo);

    /*
    查找可以再次回访的资源，visitStatus=0 或者  againVisitStatus=1 and  now()>=-againVisitTime
    * */
    Page<CustomerResource> findCanVisitCustomerResourceByQuery(DataPermission dataPermission, CustomerResourceQueryVo queryVo, int pageNo, int pageSize);

    Long countCanVisitCustomerResourceByQuery(DataPermission dataPermission, CustomerResourceQueryVo queryVo);

    boolean takeCustomerResource(Long customerResourceId, Principals.Principal principal);

    boolean alloCampus(List<Long> customerResourceIds, Long campusId , Principals.Principal principal);

    boolean alloFollow(List<Long> customerResourceIds, Long followId, Principals.Principal principal);

    List<AnalyzeStatResultOfCustomerResourceVo> analyzeCustomerResource(DataPermission dataPermission, CustomerResourceQueryVo queryVo);

    Page<AnalyzeStudentOfCustomerResourceVo> analyzeStudentOfCustomerResource(DataPermission dataPermission, CustomerResourceQueryVo queryVo, StudentRegDetailQueryVo studentRegDetailQueryVo,int pageNo, int pageSize);

    SXSSFWorkbook exportAnalyzeStudentOfCustomerResource(DataPermission dataPermission, CustomerResourceQueryVo queryVo,StudentRegDetailQueryVo studentRegDetailQueryVo);

    void updateDepartmentNameById(Long departmentId,String departmentName);

    SXSSFWorkbook exportFirstRegOfCustomerResource(DataPermission dataPermission, CustomerResourceQueryVo queryVo);

    /**
    *@Description: firstRegNum==null 或者 firstregnun==0 并且 回收时间小于当前时间的数据
    *@Param:
    *@return: 
    *@Author: lzh
    *@date: 
    */
    Page<CustomerResource> findRecycleResourceByQueryByQuery(DataPermission dataPermission, CustomerResourceQueryVo queryVo, int pageNo, int pageSize);

    SXSSFWorkbook exportCustomerResourceRecycle(DataPermission dataPermission, CustomerResourceQueryVo queryVo);

    /**
    *@Description: 根据姓名手机号性别年级校区活动日期活动名称等统计导入次数
    *@Param: 
    *@return: 
    *@Author: lzh
    *@date: 
    */
    List<CustomerResourceImportNumVo> findCustomerResourceImportNum(List<String> studentNames, List<String> phoneNos,List<String> projectNames);

    void updateSignStatusByActivityRegSituationId(long activityRegSituationId,Integer signStatus);
}